package com.jdy.haoduoaiteacher.model;

import java.util.ArrayList;
import java.util.List;



public class LeConversation {

  private static final String TAG = "conversation";

  private List<LeMessage> messages;

  private int unreadMsgCount;

  private String username;

  private boolean isGroup;

  private LeContact opposite;

  public LeConversation() {
    this.messages = new ArrayList<LeMessage>();
    this.unreadMsgCount = 0;
    this.isGroup = false;
    this.opposite = null;
  }

  public LeConversation(String username) {
    // TODO Auto-generated constructor stub
    this();
    this.username = username;
  }

  public LeMessage getMessage(int position) {
    // TODO Auto-generated method stub
    return messages.get(position);
  }

  public int getMsgCount() {
    // TODO Auto-generated method stub
    return messages.size();
  }

  public void addMessage(LeMessage message) {
    // TODO Auto-generated method stub
    messages.add(message);
  }

  public boolean contains(long ctime) {
    for (LeMessage lm : messages)
      if (lm.msgTime == ctime)
        return true;
    return false;
  }

  public void clear() {
    messages.clear();
  }

  public LeMessage getLastMessage() {
    return messages.get(messages.size() - 1);
  }

  public void resetUnreadMsgCount() {
    // TODO Auto-generated method stub
    this.unreadMsgCount = 0;
  }

}
